package com.youbug.system.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.youbug.common.vo.QueryVo;
import com.youbug.system.entity.JobExecHis;
import com.youbug.system.service.IJobExecHisService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.*;
import com.youbug.common.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 定时任务执行记录表 前端控制器
 * </p>
 *
 * @author youbug
 * @since 2023-11-12
 */
@RestController
@RequestMapping("/jobExecHis")
public class JobExecHisController {
@Autowired
private IJobExecHisService jobExecHisService;

    @PostMapping("/getJobExecHisPage")
    public R<IPage<JobExecHis>> getJobExecHisPage(@RequestBody QueryVo<JobExecHis> queryVo){

        IPage<JobExecHis> jobExecHiss = jobExecHisService.getJobExecHisPage(queryVo);

        return R.ok(jobExecHiss);
    }

    @GetMapping("/getJobExecHisById/{id}")
    public R<JobExecHis> getMenusForRole(@PathVariable Integer id){

        JobExecHis jobExecHis = jobExecHisService.getById(id);

        return R.ok(jobExecHis);
    }

    @PostMapping("/add")
    public R<Boolean> add(@RequestBody JobExecHis jobExecHis){

        boolean save = jobExecHisService.save(jobExecHis);

        return  R.ok(save);
    }

    @PostMapping("/update")
    public R<Boolean> update(@RequestBody JobExecHis jobExecHis){

        boolean update = jobExecHisService.updateById(jobExecHis);

        return  R.ok(update);
    }

    @GetMapping("/delete/{id}")
    public R<Boolean> delete(@PathVariable Integer id){

        boolean remove = jobExecHisService.removeById(id);

        return  R.ok(remove);
    }
}

